package org.ligson.httptest.util;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.List;

@Slf4j
public class UserUtil {
    public static List<String> getUserCode(int len) {
        File file = new File("./crux-httptest/usercode.txt");
        List<String> lines = null;
        try {
            lines = FileUtils.readLines(file, "UTF-8");
        } catch (IOException e) {
            log.error("读取用户名失败:{}", e.getMessage(), e);
            return Collections.emptyList();
        }
        return lines.subList(0, len);
    }
}
